package net.cmkj.mine.bean;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class CmkjTree implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String id;
	private String title;
	private boolean spread;
	private String url;
	private String image;
	private String state;
	private String checked;
	private Map<String, String> attributes;
	private List<CmkjTree> children;
	private String fuid;

    /**
	 * @return the id
	 */
	public String getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(String id) {
		this.id = id;
	}

	/**
	 * @return the name
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * @param
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * @return the url
	 */
	public String getUrl() {
		return url;
	}

	/**
	 * @param url the url to set
	 */
	public void setUrl(String url) {
		this.url = url;
	}

	/**
	 * @return the image
	 */
	public String getImage() {
		return image;
	}

	/**
	 * @param image the image to set
	 */
	public void setImage(String image) {
		this.image = image;
	}

	/**
	 * @return the state
	 */
	public String getState() {
		return state;
	}

	/**
	 * @param state the state to set
	 */
	public void setState(String state) {
		this.state = state;
	}

	/**
	 * @return the checked
	 */
	public String getChecked() {
		return checked;
	}

	/**
	 * @param checked the checked to set
	 */
	public void setChecked(String checked) {
		this.checked = checked;
	}

	/**
	 * @return the attributes
	 */
	public Map<String, String> getAttributes() {
		return attributes;
	}

	/**
	 * @param attributes the attributes to set
	 */
	public void setAttributes(Map<String, String> attributes) {
		this.attributes = attributes;
	}

	/**
	 * @return the children
	 */
	public List<CmkjTree> getChildren() {
		return children;
	}

	/**
	 * @param children the children to set
	 */
	public void setChildren(List<CmkjTree> children) {
		this.children = new ArrayList<CmkjTree>();
		CmkjTree tree;
		for (int i = 0; i < children.size(); i++) {
			tree = children.get(i);
			if (tree.getFuid() != null && !tree.getFuid().equals("") && !tree.getFuid().equals("0") && tree.getFuid().equals(id)) {
				this.children.add(tree);
				tree.setChildren(children);
			}
		}
	}

	/**
	 * @return the fuid
	 */
	public String getFuid() {
		return fuid;
	}

	/**
	 * @param fuid the fuid to set
	 */
	public void setFuid(String fuid) {
		this.fuid = fuid;
	}

    public boolean isSpread() {
        return spread;
    }

    public void setSpread(boolean spread) {
        this.spread = spread;
    }
}
